import java.util.Random;


public class Wheel {
	
	private double speed = 0;
	
	private double noiseMultiplier = 5.5; // sensor
	private double errorMultiplier = 2.5; // motor
	
	private Random rand = new Random();
	
	public Wheel() {
		speed = 0;
	}
	
	public Wheel(double speed) {
		this.speed = speed;
	}
	
	/**
	 * CHOOSE WHETHER YOU WANT NOISE
	 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	 * @return
	 */
	public double getSpeed() {
		return getSpeedWithGaussNoise();
		//return speed;
	}
	
	/**
	 * CHOOSE WHETHER YOU WANT ERROR
	 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	 * @param speed
	 */
	public void setSpeed(double speed) {
		//this.speed = speed;
		setSpeedWithGaussError(speed);
	}
	
	private double getSpeedWithGaussNoise() {
		return speed + (rand.nextGaussian() * noiseMultiplier);
	}
	
	private void setSpeedWithGaussError(double speed) {
		this.speed = speed + (rand.nextGaussian() * errorMultiplier);
	}

}
